package books.storage.service;

import java.util.Date;
import java.util.List;

import javax.ejb.Remote;


import books.storage.dto.BookDto;
import books.storage.dto.LiteraryGenreDto;
import books.storage.exception.EntityNotFoundException;
import books.storage.exception.NotEnoughtExemplaireException;

@Remote
public interface IBooksManagerBean {

	/*
	 * INSERT METHODS
	 */

	public LiteraryGenreDto addNewLiteraryGenre(LiteraryGenreDto _genre)
			throws EntityNotFoundException;

	public BookDto addNewBook(BookDto _book) throws EntityNotFoundException;

	/*
	 * DELETE METHODS
	 */

	public void deleteLiteraryGenre(LiteraryGenreDto _genre)
			throws EntityNotFoundException;

	public void deleteBook(BookDto _book) throws EntityNotFoundException;

	/*
	 * UPDATE METHODS
	 */

	public LiteraryGenreDto updateLiteraryGenre(LiteraryGenreDto _genre)
			throws EntityNotFoundException;

	public BookDto updateBook(BookDto _book)
			throws EntityNotFoundException;
	
	public BookDto addCopies(int copiesNumber, BookDto _book)
			throws EntityNotFoundException;

	public BookDto removeCopies(int copiesNumber, BookDto _book)
			throws EntityNotFoundException, NotEnoughtExemplaireException;

	/*
	 * FIND METHODS
	 */

	public LiteraryGenreDto findLiteraryGenreDto(Integer _id)
			throws EntityNotFoundException;

	public BookDto findBookDto(String _ISBN) throws EntityNotFoundException;

	/*
	 * SELECT METHODS
	 */

	public List<BookDto> searchBookByName(String _title);

	public List<BookDto> searchBookByAuthor(String _name);

	public List<BookDto> searchBookBetweenEditionDates(Date _first, Date _second);

	public List<BookDto> searchBookByLiteraryGenre(String _genreName);

	/*
	 * GET ALL
	 */

	public List<BookDto> findAllBooks();

	public List<LiteraryGenreDto> findAllGenre();
}
